package org.mock.service.impl;

import cn.hutool.core.util.ObjectUtil;
import org.mock.entity.SabreMockScene;
import org.mock.mapper.SabreMockSceneMapper;
import org.mock.service.SabreMockSceneService;
import org.mock.dto.SabreMockSceneDTO;
import org.mock.common.Condition;
import org.mock.utils.BeanCopyUtils;
import org.springframework.stereotype.Service;
import lombok.AllArgsConstructor;
import cn.hutool.core.util.StrUtil;

/**
 * sabre_mock场景 服务实现类
 *
 * @author AI
 * @since 2025-06-16
 */
@Service
@AllArgsConstructor
public class SabreMockSceneServiceImpl implements SabreMockSceneService {

    protected SabreMockSceneMapper sabreMockSceneMapper;

    @Override
    public String getMockNoByStatus(Integer mockStatus) {
        SabreMockSceneDTO dto = new SabreMockSceneDTO();
        dto.setState(mockStatus);
        SabreMockScene one = this.getOne(dto);
        if (ObjectUtil.isEmpty(one)) {
            return StrUtil.EMPTY;
        }
        return one.getMockNo();
    }

    @Override
    public SabreMockScene getOne(SabreMockSceneDTO dto) {
        return sabreMockSceneMapper.selectOne(Condition.getQueryWrapper(BeanCopyUtils.copy(dto, SabreMockScene.class)));
    }
}
